package com.service.edu.controller;


import com.service.edu.pojo.CourseCollect;
import com.service.edu.service.CourseCollectService;
import com.service.utils.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;

import javax.xml.transform.Result;
import java.util.Date;

/**
 * <p>
 * 课程收藏 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-09-28
 */
@RestController
@RequestMapping("course-collect")
@Api(description = "课程收藏")
public class CourseCollectController {

    @Autowired
    private CourseCollectService courseCollectService;

    @PostMapping
    @ApiOperation("添加收藏课程")
    public ResultVo save(@ApiParam(name = "courseCollect",value = "收藏课程对象",required = true) @RequestBody CourseCollect courseCollect){
        courseCollect.setGmtCreate(new Date());
        courseCollect.setGmtModified(new Date());
        boolean save = courseCollectService.save(courseCollect);
        if (save){
            return ResultVo.ok();
        }
        return ResultVo.error();
    }


}

